/**   
* @Title: ContentController.java 
* @Package com.taotao.rest.controller 
* @Description: TODO(用一句话描述该文件做什么) 
* @author hekai   
* @date 2017年3月1日 下午9:59:37 
* @version V1.0   
*/
package com.taotao.rest.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.pojo.TaotaoResult;
import com.taotao.common.utils.ExceptionUtil;
import com.taotao.pojo.TbContent;
import com.taotao.rest.service.ContentService;

/** 
* @ClassName: ContentController 
* @Description: 内容管理Controller
* @author hekai
* @date 2017年3月1日 下午9:59:37 
*  
*/
@Controller
public class ContentController {
	
	@Autowired
	private ContentService contentService;
	
	@RequestMapping("/content/{cid}")
	@ResponseBody
	public TaotaoResult getContentList(@PathVariable Long cid){
		try {
			List<TbContent> list = contentService.getContentList(cid);
			return TaotaoResult.ok(list);
		} catch (Exception e) {
			e.printStackTrace();
			return TaotaoResult.build(500, ExceptionUtil.getStackTrace(e));
		}
	}
	
	@RequestMapping("/sync/content/{cid}")
	@ResponseBody
	public TaotaoResult sysnContent(@PathVariable Long cid){
		try {
			contentService.syncContent(cid);
			return TaotaoResult.ok();
		} catch (Exception e) {
			e.printStackTrace();
			return TaotaoResult.build(500, ExceptionUtil.getStackTrace(e));
		}
	}
}















